package com.sec.service;

import java.util.HashMap;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

import com.sec.util.PermissionUtil;

public class PermissionService {
	
	public SharedPreferences preferences;	
	
	public void setPersonPermission(PermissionUtil pu){
		Editor editor = preferences.edit();
		editor.putBoolean(pu.getPersonName()+"_"+pu.ISCALLDEFAULT,pu.isCallDefault());
		editor.putBoolean(pu.getPersonName()+"_"+pu.ISKILLCALL,pu.isKillCall());
		editor.commit();
	}
	
	/*public void setPersonPermission(String name,boolean isChecked){
		Editor editor = preferences.edit();
		editor.putBoolean(name,isChecked);
		editor.commit();
	}*/
	
	
	public PermissionUtil getPersonPermission(String personName){
		PermissionUtil pu = new PermissionUtil();
		pu.setCallDefault(preferences.getBoolean(personName+"_"+pu.ISCALLDEFAULT, true));
		pu.setKillCall(preferences.getBoolean(personName+"_"+pu.ISKILLCALL, false));
		pu.setPersonName(personName);
		return pu;
	}
	
	
	
}
